<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="t_bar">${param.title7 }</div>

<table id="basicProjectInfo" border="0" cellspacing="0" cellpadding="0" class="table01 t_css" >
	<col style="width:20%"/>
	<col style="width:30%"/>
	<col style="width:20%"/>
	<col style="width:30%"/>
	<tr>
		<td align="right"><span class="color_red">*</span>项目名称：</td>
		<td colspan="3">
			<span name="proposal/zh_title">
				<x:out select="$xmlData/data/organizations/organization[@submit_org='1']/org_name" />购买省外先进技术成果补助
			</span>
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>归口管理部门：</td>
		<td>
			<c:set var="recomend_org">
				{'id':'<x:out select="$xmlData/data/proposal/recomend_org_value" />',
				'name':'<x:out select="$xmlData/data/proposal/recomend_org_name" />'
				}					
			</c:set>
			<cpt:tree id="recomend_org" key="recommended_org" cacheable="false"
				className="hn_iuput_kuang required selectWidth3" readonly="true"
				value="${recomend_org}" label="项目基本情况-->归口管理部门" showPattern="all"
				shieldPattern="0" onClick="initTreeValue2">
			</cpt:tree>
			<input type="hidden" id="recomend_org_value"
				name="proposal/recomend_org_value"
				value="<x:out select="$xmlData/data/proposal/recomend_org_value" />" />
			<input type="hidden" name="proposal/recomend_org_name"
				value="<x:out select="$xmlData/data/proposal/recomend_org_name" />" />
		</td>
		<td  align="right" ><span class="color_red">*</span>申请日期：</td>
		<td>
			<c:set var="submit_date"><x:out select="$xmlData/data/proposal/submit_date" /></c:set>
			<cpt:date id="submit_date" name="proposal/submit_date" value="${submit_date}" className=" required date" label="申请日期"></cpt:date> 
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>单位类型：<br/>（多选）</td>
		<td colspan="3">
			<c:set var="unit_type2_value"><x:out select="$xmlData/data/proposal/unit_type2_value" /></c:set>
			<cpt:checkbox key="unit_type2" name="unit_type2" repeatColumn="4" ></cpt:checkbox>
			<input type="hidden" name="proposal/unit_type2_value" class="required"  value="${unit_type2_value}" label="单位类型">
			<input type="hidden" name="proposal/unit_type2_name" value="<x:out select="$xmlData/data/proposal/unit_type2_name" />"> </td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>项目联系人姓名：</td>
		<td> 
			<%-- <span name="proposal/contact_psn_cname">
				<x:out select="$xmlData/data/organization_persons/organization_person[@psn_type='lianxiren']/contact_name"/>
		    </span> --%>
		    <input  type="text" label="项目联系人姓名" name="proposal/contact_psn_cname" class="input_css required" maxlength="11" value="<x:out select="$xmlData/data/proposal/contact_psn_cname" />">
		</td>
		<input type="hidden" name="proposal/contact_psn_tel" value="<x:out select="$xmlData/data/organization_persons/organization_person[@psn_type='lianxiren']/contact_tel"/>"/>
		<input type="hidden" name="proposal/contact_psn_email" value="<x:out select="$xmlData/data/organization_persons/organization_person[@psn_type='lianxiren']/contact_email"/>"/>
		<td align="right"><span class="color_red">*</span>联系人手机：</td>
		<td> 
			<%-- <span name="proposal/contact_psn_mobile">
				<x:out select="$xmlData/data/organization_persons/organization_person[@psn_type='lianxiren']/contact_mobile" />
		    </span> --%>
		    <input type="text" label="联系人手机" name="proposal/contact_psn_mobile" class="input_css required mobile" maxlength="11" value="<x:out select="$xmlData/data/proposal/contact_psn_mobile" />">
		</td>
	</tr>
	<tr>
		 <td align="right"><span class="color_red">*</span>项目报审级次：<br/>（省补助资金拨付所属财政局）</td>
	        <td>
				<c:set var="sub_step">{'id':'<x:out select="$xmlData/data/proposal/sub_step_value" />','name':'<x:out select="$xmlData/data/proposal/sub_step_name" />'}</c:set>
	          	<cpt:tree key="sub_step" cacheable="false" className="hn_iuput_kuang  " readonly="true" value="${sub_step}"  label="项目报审级次" 
	          		id="sub_step" onlyChooseLeaf="false" showPattern="all" shieldPattern="0" topCheckbox="true" onClick="initTreeValueExt" />
		        <input id="sub_step_value" type="hidden" name="proposal/sub_step_value" class="required" label="项目报审级次" value="<x:out select="$xmlData/data/proposal/sub_step_value" />"/>
	            <input id="sub_step_name" type="hidden" name="proposal/sub_step_name"  value="<x:out select="$xmlData/data/proposal/sub_step_name" />"/>
			</td>
		<td align="right"><span class="color_red">*</span>申请补助金额（万元）：</td>
		<td> 
			<input id="application_amount" name="proposal/application_amount" label="申请补助金额（万元）" type="text" 
			onfocus="InitInput.setNumber(this,9,4,2);" required class="input_css required maxlength:50"  style="text-align:right" maxlength="50" 
			value="<x:out select="$xmlData/data/proposal/application_amount" />"/>
		</td>
	</tr>
	
	<tr>
		<td align="right" rowspan="2"><span class="color_red">*</span>购买省外技术成果，并于${statYear -1}年<br/>实际支付的全部技术成果(项/万元)：</td>
		<td align="right"><span class="color_red">*</span>项目数（项）：</td>
		<td>
			<input id="project_number" name="proposal/project_number" label="项目数（项）" type="text" onfocus="InitInput.setNumber(this,6,0,0);"  class="input_css required maxlength:50" 
			 style="text-align:right" maxlength="50" value="<x:out select="$xmlData/data/proposal/project_number" />"/>
		</td>
		<td></td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>实际支付经费（万元）：</td>
		<td>
			<input id="pay_expenses" name="proposal/pay_expenses" label="实际支付经费" type="text" onfocus="InitInput.setNumber(this,9,4,2);"  class="input_css required maxlength:50" 
			 style="text-align:right" maxlength="50" value="<x:out select="$xmlData/data/proposal/pay_expenses" />"/>
		</td>
		<td></td>
	</tr>
</table>
<table  id="basicContractInfo" border="0" cellspacing="0" cellpadding="0" class="table01" >
		<thead>
               <tr style="border:1px solid #B7D1E6"> 
					<th class="TblHead" align="center"  width="5%">选择</th>
					<th class="TblHead" align="center"  width="5%">序号</th>
					<th class="TblHead" align="center"  width="16%">技术合同名称</th>
					<th class="TblHead" align="center"  width="12%">合同起止时间</th>
					<!-- <th class="TblHead" align="center"  width="12%">合同结束日期</th> -->
					<th class="TblHead" align="center"  width="12%">卖方单位名称</th> 
					<th class="TblHead" align="center"  width="12%">卖方所在（国、省、市）</th>
					<th class="TblHead" align="center"  width="11%">${statYear -1}年实际支付金额<br/>（以发票为准，单位/万元）</th>
			</tr>
		</thead>
		<tbody id="tab">
			<tr style="display: none">
				<td align="center">
				<input type="radio" class="radiobutton" name="selcontracts" >
				<input type="hidden" name="contracts|contract[0]|transaction_type_value"/>
            	<input type="hidden" name="contracts|contract[0]|transaction_type_name"/>
             	<input type="hidden" name="contracts|contract[0]|technical_field_value"/>
            	<input type="hidden" name="contracts|contract[0]|technical_field_name"/>
           		<input type="hidden" name="contracts|contract[0]|technical_level_value"/>
           		<input type="hidden" name="contracts|contract[0]|technical_level_name"/>
				<input type="hidden" name="contracts|contract[0]|seller_type_value"/>
           		<input type="hidden" name="contracts|contract[0]|seller_type_name"/>
            	<input type="hidden" name="contracts|contract[0]|contract_amount"/>
				<input type="hidden" name="contracts|contract[0]|payed_amount"/>
				<input type="hidden" name="contracts|contract[0]|imported_amount"/>
				<input type="hidden" name="contracts|contract[0]|research_amount"/>
				<input type="hidden" name="contracts|contract[0]|expect_stand"/>
				<input type="hidden" name="contracts|contract[0]|international_stand"/>
				<input type="hidden" name="contracts|contract[0]|country_stand"/>
				<input type="hidden" name="contracts|contract[0]|industry_stand"/>
				<input type="hidden" name="contracts|contract[0]|intellectual_property"/>
				<input type="hidden" name="contracts|contract[0]|invention_patent"/>
				<input type="hidden" name="contracts|contract[0]|transform_status_hidden">
				<input type="hidden" name="contracts|contract[0]|transform_status">
				</td>
						<td align="center">
							<span name="contracts|contract[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">
							<input name="contracts|contract[0]|project_name" label="技术合同名称" disabled type="text" class="input_css required maxlength:100"  style="width: 90%;" maxlength="100" value=""/>
						</td>
						<td align="center">&nbsp; <input id="contract_start_date_[0]"
							name="contracts|contract[0]|start_date" label="合同开始日期" disabled value=""
							class=" required gray input_css date  dateCompare:contract_end_date_[0]"
							style="width: 80px" label="开始日期" />
						<br/>至<br/>
						<input id="contract_end_date_[0]"
							name="contracts|contract[0]|end_date" label="合同结束日期"  disabled value=""
							class=" required gray input_css date "
							style="width: 80px" label="结束日期" />
						</td>
						<td align="left">
						
							<input name="contracts|contract[0]|seller_dept" label="卖方单位名称" type="text" disabled  type="text" class="input_css required "  style="width: 80%;" value=""/>
						</td> 
						<td align="left">
							<input name="contracts|contract[0]|seller_address" label="卖方所在（国、省、市）"  disabled type="text" class="input_css required"  style="width: 80%;"  value=""/>
						</td>
						<td align="center">
							<input name="contracts|contract[0]|year_amount" label="${statYear -1}年实际支付金额" disabled class="input_css required"  type="text" class="input_css required"  style="width: 80%;text-align:right;"
							onfocus="InitInput.setNumber(this,9,2,2)" onchange="totaltwo();" value=""/>
						</td>
			</tr>
			<c:set value="0" var="index" scope="page" />
			<x:forEach select="$xmlData/data/contracts/contract" var="contract">
				<c:choose>
					<c:when test="${index<10}">
						<c:set value="0" var="flag" scope="page" />
					</c:when>
					<c:otherwise>
						<c:set value="" var="flag" scope="page" />
					</c:otherwise>
				</c:choose>
				<tr>
						<td align="center">
							<input type="radio" class="radiobutton" name="selcontracts" >
							<input type="hidden" name="contracts/contract[${flag}${index}]/transaction_type_value" value="<x:out select="$contract/transaction_type_value"/>"/>
			            	<input type="hidden" name="contracts/contract[${flag}${index}]/transaction_type_name" value="<x:out select="$contract/transaction_type_name"/>"/>
			             	<input type="hidden" name="contracts/contract[${flag}${index}]/technical_field_value" value="<x:out select="$contract/technical_field_value"/>"/>
			            	<input type="hidden" name="contracts/contract[${flag}${index}]/technical_field_name" value="<x:out select="$contract/technical_field_name"/>"/>
			           		<input type="hidden" name="contracts/contract[${flag}${index}]/technical_level_value" value="<x:out select="$contract/technical_level_value"/>"/>
			           		<input type="hidden" name="contracts/contract[${flag}${index}]/technical_level_name" value="<x:out select="$contract/technical_level_name"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/seller_type_value" value="<x:out select="$contract/seller_type_value"/>"/>
			           		<input type="hidden" name="contracts/contract[${flag}${index}]/seller_type_name" value="<x:out select="$contract/seller_type_name"/>"/>
			            	<input type="hidden" name="contracts/contract[${flag}${index}]/contract_amount" value="<x:out select="$contract/contract_amount"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/payed_amount" value="<x:out select="$contract/payed_amount"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/imported_amount" value="<x:out select="$contract/imported_amount"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/research_amount" value="<x:out select="$contract/research_amount"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/expect_stand" value="<x:out select="$contract/expect_stand"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/international_stand" value="<x:out select="$contract/international_stand"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/country_stand" value="<x:out select="$contract/country_stand"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/industry_stand" value="<x:out select="$contract/industry_stand"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/intellectual_property" value="<x:out select="$contract/intellectual_property"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/invention_patent" value="<x:out select="$contract/invention_patent"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/transform_status_hidden" value="<x:out select="$contract/transform_status_hidden"/>"/>
							<input type="hidden" name="contracts/contract[${flag}${index}]/transform_status" value="<x:out select="$contract/transform_status"/>"/>
						</td>
						<td align="center">
							<span   name="contracts/contract[${flag}${index}]@seq_no" ><x:out select="$contract/@seq_no"/></span> 
						</td>
						
						<td align="center">
							<input name="contracts/contract[${flag}${index}]/project_name" label="名称" type="text" disabled class="input_css required maxlength:100"  style="width: 90%;" maxlength="100" value="<x:out select="$contract/project_name"/>"/>
						</td>
						 
						<td align="center">&nbsp;<c:set var="start_date" scope="page"><x:out select="$contract/start_date" /></c:set> 
						<input id="contract_start_date_[${flag}${index}]" value="${start_date}" label="合同开始日期" type="text" disabled
							name="contracts/contract[${flag}${index}]/start_date"
							class="required gray date input_css dateCompare:contract_end_date_[${flag}${index}] " style="width: 80px" />
						<br/>至<br/>
						 <c:set var="end_date" scope="page"><x:out select="$contract/end_date" /></c:set> 
						<input id="contract_end_date_[${flag}${index}]" type="text" disabled
							name="contracts/contract[${flag}${index}]/end_date" 
							value="${end_date}" class="required date input_css gray" style="width: 80px" label="合同结束日期"/>
						</td>
						<td align="left">
						
							<input name="contracts/contract[${flag}${index}]/seller_dept" label="卖方单位名称" type="text"   disabled
							type="text" class="input_css required"  style="width: 80%;"  value="<x:out select="$contract/seller_dept"/>"/>
						</td> 
						<td align="left">
							<input name="contracts/contract[${flag}${index}]/seller_address" label="卖方所在（国、省、市）"  disabled
							type="text" class="input_css required"  style="width: 80%;"  value="<x:out select="$contract/seller_address"/>"/>
						</td>
						<td align="center">
							<input name="contracts/contract[${flag}${index}]/year_amount"  label="${statYear -1}年实际支付金额" type="text" disabled class="input_css required"  style="width: 80%;text-align:right;" 
							onfocus="InitInput.setNumber(this,9,4,2)" onchange="totaltwo();" value="<x:out select="$contract/year_amount"/>" />
						</td>
				</tr>
				<c:set value="${index+1}" var="index" scope="page" />
			</x:forEach>
			</tbody>
	</table>
	<table  id="" border="0" cellspacing="0" cellpadding="0" class="table01" >
		<col style="width: 86.8%" />
		<col style="width: 13.2%" />
		<tr>
			<td align="center">
				合计（万元）
			</td>
			<td align="center">
				<input style="text-align:right;width: 80%" class="gray" type="text" id="seltotalone" disabled 
				name="contracts/year_amount_total" value="<x:out select="$xmlData/data/contracts/year_amount_total" />"/>
			</td>	
		</tr>
	</table>
<br>

	<table border="0" cellpadding="0" cellspacing="1">
		<tr>
			<td>
				<input class="button_02" type="button" value="添加" onclick="if(checkTabLimit('basicContractInfo',99,'单项成果信息最多只能填写99条')){addNewRow('basicContractInfo','${ctx}/proposal/edit/dialog/achieveInfoAdd_zy?parentTab=basicContractInfo&type=add&needMeetingInfo=${param.needMeetingInfo}&year=${statYear}&TB_iframe=true&height=440&width=900','添加单项成果信息');}try{top.resizeFrame();}catch(e){};">
				&nbsp;<input class="button_02"  id="zh_psnPrev" type="button" value="上移" onclick="movePrev('basicContractInfo');">
				&nbsp;<input class="button_02"  id="zh_psnNext" type="button" value="下移" onclick="moveNext('basicContractInfo');">
				&nbsp;<input class="button_02"  id="zh_psnEdit" type="button" value="编辑" onclick="editRow('basicContractInfo','${ctx}/proposal/edit/dialog/achieveInfoAdd_zy?parentTab=basicContractInfo&type=edit&needMeetingInfo=${param.needMeetingInfo}&TB_iframe=true&height=440&width=900','编辑单项成果信息')">
				&nbsp;<input class="button_02"  id="zh_psnDel" type="button" value="删除" onclick="deleteSelectedRow('basicContractInfo','单项成果信息');totaltwo();"></td>
		</tr>
	</table>
<script type="text/javascript">
function totaltwo(){
	var tr=$("#basicContractInfo").find("tr");
	var value=$("#basicContractInfo").find("input[name$='year_amount']");
	var total=0;
	  for(var  i = 1 ;i < tr.length-1 ;i++)  
	  {  
		  if(!!$(value[i]).val()){
			var toCountNum=parseFloat($(value[i]).val());
		 	total = total + toCountNum;
		  }
	  } 
	  total= formatNumberAutoOther(total.toString(), 9, 4, 2);
	$("#seltotalone").val(total);
}

function initTreeValueExt(treeId, treeNode) {
 	if ((treeNode && treeNode.isParent)) {
 		scmWarn("请选择具体的" + $("#" + treeId).attr("label"));
 		$("#" + treeId).val("");
 		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val("");
 		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId	+ "_value']").val("");
 		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val("");
 		return false;
 	}
 	var str = treeNode.name;
 	var obj = treeNode.parentNode;
 	while (obj != null) {
 		str = obj.name + "-" + str;
 		obj = obj.parentNode;
 	}
 	
 	$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val(treeNode.id);
 	$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val(treeNode.id);
 	$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val(str);
 }
</script>





























	
